home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
176-200
/
scopedisk180
/
arexxtutorial
/
more_examples
/
arcall.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
1KB
|
46 lines
/* arcall.rexx - ARC all files within a directory, including subdirectories.
Rename all files, generate a scriptto recreate the original
file structure
By Larry Phillips. Use this code in whatever way you like.
*/
arg root
if right(root,1) ~= ':' then
root = root || '/'
if root = '/' then root = ''
filecount = 1
dummy = open(execfile,root || 'Exec.me','write')
call renamefiles(root)
say
call close(execfile)
'arc a arcfile *'
exit 0
renamefiles: procedure expose filecount root
parse arg x
contents = showdir(x);
do i = 1 to words(contents)
temp = x || word(contents,i)
select
when word(statef(temp),1) = 'FILE' then do
rename temp root || 'File' || filecount
call writeln(execfile,'rename File' || filecount x || word(contents,i))
call writech(stdout,'.')
filecount = filecount + 1
end
when word(statef(temp),1) = 'DIR' then do
call writeln(execfile,'')
call writeln(execfile,'makedir' temp)
call renamefiles(temp || '/')
end
otherwise do
if translate(temp) = 'EXEC.ME' then break
else say 'Error: File' temp 'is neither DIR nor FILE.'
end
end
end
call writeln(execfile,'')
return 0